/** 
 * 2011-10-11 上午11:30:39 
 * UdpLoginAction.java 
 * author:sunb 
 */
package com.u6.udp.action;

import java.net.SocketAddress;

import org.jboss.netty.channel.MessageEvent;

import com.u6.udp.netty.UdpAction;
import com.u6.udp.netty.UdpMessage;
import com.u6.udp.util.MethodID;
import com.u6.udp.util.UdpContext;

/**
 * @author sunbin
 * 
 */
public class UdpLoginAction extends UdpAction {

	@Override
	public void execute(MessageEvent event) {
		// TODO Auto-generated method stub
		UdpMessage message = getMessage();
		long uid=message.getSendUid();
	
		SocketAddress address = event.getRemoteAddress();
		
		UdpContext.addAddress(message.getSendUid(), address);
		
		message.setMessageID(MethodID.Login.Success);
		event.getChannel().write(message, address);

	}

}
